package org.supda.system.entity;

import java.sql.Timestamp;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * TMessageSend entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "t_message_send", catalog = "comsys")
public class TMessageSend implements java.io.Serializable {

	// Fields

	private TMessageSendId id;
	private TUser TUser;
	private TMessage TMessage;
	private Short sendStatus;
	private Integer sendTimes;
	//是否已阅读
	private Short readFlag;
	private Timestamp sendTime;

	// Constructors

	/** default constructor */
	public TMessageSend() {
	}

	/** minimal constructor */
	public TMessageSend(TMessageSendId id, TUser TUser, TMessage TMessage,
			Short sendStatus, Integer sendTimes) {
		this.id = id;
		this.TUser = TUser;
		this.TMessage = TMessage;
		this.sendStatus = sendStatus;
		this.sendTimes = sendTimes;
	}

	/** full constructor */
	public TMessageSend(TMessageSendId id, Short sendStatus, Short readFlag ,  Integer sendTimes) {
		this.id = id;
		this.sendStatus = sendStatus;
		this.sendTimes = sendTimes;
		this.readFlag = readFlag;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "userId", column = @Column(name = "user_id", nullable = false)),
			@AttributeOverride(name = "messageId", column = @Column(name = "message_id", nullable = false)) })
	public TMessageSendId getId() {
		return this.id;
	}

	public void setId(TMessageSendId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id", nullable = false, insertable = false, updatable = false)
	public TUser getTUser() {
		return this.TUser;
	}

	public void setTUser(TUser TUser) {
		this.TUser = TUser;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "message_id", nullable = false, insertable = false, updatable = false)
	public TMessage getTMessage() {
		return this.TMessage;
	}

	public void setTMessage(TMessage TMessage) {
		this.TMessage = TMessage;
	}

	@Column(name = "send_status", nullable = false )
	public Short getSendStatus() {
		return this.sendStatus;
	}

	public void setSendStatus(Short sendStatus) {
		this.sendStatus = sendStatus;
	}

	@Column(name = "send_times", nullable = false)
	public Integer getSendTimes() {
		return this.sendTimes;
	}

	public void setSendTimes(Integer sendTimes) {
		this.sendTimes = sendTimes;
	}

	@Column(name = "send_time", length = 0)
	public Timestamp getSendTime() {
		return this.sendTime;
	}

	public void setSendTime(Timestamp sendTime) {
		this.sendTime = sendTime;
	}

	@Column(name = "read_flag", nullable = false)
	public Short getReadFlag() {
		return readFlag;
	}

	public void setReadFlag(Short readFlag) {
		this.readFlag = readFlag;
	}

	
}